import 'package:flutter/material.dart';
import 'package:meal/constant/fonts.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 应用权限说明
///
class PrivacyPermission extends StatefulWidget {
  const PrivacyPermission({Key? key}) : super(key: key);

  @override
  State<PrivacyPermission> createState() => _PrivacyPermissionState();
}

class _PrivacyPermissionState extends State<PrivacyPermission> {
  TextStyle get defaultStyle {
    return StylesUtils.customTextStyle(fontSize: Sizes.default15, color: ColorsUtils.color000);
  }

  TextStyle get fontWeightStyle {
    return StylesUtils.customTextStyle(
        fontSize: Sizes.default15, color: ColorsUtils.color000, fontWeight: Fonts.w7);
  }

  TextStyle get tableFontWeight {
    return StylesUtils.customTextStyle(
        fontSize: Sizes.default15, color: ColorsUtils.color333, fontWeight: Fonts.w7);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: ToolsUtils.getDefaultBrnAppBar('应用权限说明'),
      body: SingleChildScrollView(
        physics: const BouncingScrollPhysics(),
        padding: const EdgeInsets.all(Sizes.default15),
        child: Column(
          children: [
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '为保障小默外卖产品功能实现与安全稳定运行至目的，我们可能会申请或使用操作系统的相关权限；',
                style: defaultStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '为保障您的知情权，我们通过下列列表将产品可能申请、使用的相关操作系统权限进行展示，您可以根据实际需要对相关权限进行管理；',
                style: defaultStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '根据产品的升级，申请、使用权限的类型与目的可能会有变动，我们将及时根据这些变动对列表进行调整，以确保您及时获悉权限的申请与使用情况；',
                style: defaultStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '请您知悉，我们为业务与产品的功能与安全需要，我们可能也会使用第三方及关联方SDK，这些第三方也可能会申请或使用相关操作系统权限；',
                style: defaultStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '在使用产品的过程中，您可能会使用第三方开发的H5页面或小程序，这些第三方开发的插件或小程序也可能因业务功能所必需而申请或使用相关操作系统权限。',
                style: defaultStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Text(
                '安卓操作系统应用权限列表',
                style: fontWeightStyle,
              ),
            ),
            Container(
              alignment: Alignment.centerLeft,
              margin: const EdgeInsets.only(bottom: Sizes.default20),
              child: Table(
                border: TableBorder.all(
                    color: ColorsUtils.parseColorFromHexString(ColorsUtils.color333)),
                textDirection: TextDirection.ltr,
                defaultVerticalAlignment: TableCellVerticalAlignment.middle,
                children: [
                  TableRow(children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default5),
                          child: Text('权限名称', style: tableFontWeight),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default5),
                          child: Text(
                            '权限功能说明',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default5),
                          child: Text(
                            '使用场景或目的',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                  ]),
                  TableRow(children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text('CAMERA拍摄', style: tableFontWeight),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text(
                            '使用拍摄照片和视频、完成扫描二维码',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text(
                            '录制视频时使用',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                  ]),
                  TableRow(children: [
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text('GET_ACCOUNTS获取应用账户', style: tableFontWeight),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text(
                            '获取设备上已安装的应用创建的账号，请您放心，该权限仅获取应用相关的信息，无法获取您的银行账号密码等个人敏感信息',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                    TableCell(
                        verticalAlignment: TableCellVerticalAlignment.middle,
                        child: Container(
                          alignment: Alignment.center,
                          padding: const EdgeInsets.all(Sizes.default10),
                          child: Text(
                            '用于帮助您通过第三方账号登录App',
                            style: tableFontWeight,
                          ),
                        )
                    ),
                  ]),
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
